// @Author EthanScriptOn
// @Desc
package config_processor

import (
	"errors"
	"gitee.com/fatzeng/srf_switch_basic_components/identity"
	"gitee.com/fatzeng/srf_switch_basic_components/processor"
	"gitee.com/fatzeng/srf_switch_config/config_define"
)

type ResourceProcessorEntity struct {
	identity.IdentityInformation
	ResourceProcessor processor.Processor
	EntityPriority    int
	SupportedList     []config_define.ConfigSourceType
}

func (r *ResourceProcessorEntity) IsValid() (err error) {
	if r.ResourceProcessor == nil {
		return errors.New("processor is nil")
	}
	if len(r.SupportedList) <= 0 {
		return errors.New("list without annotated support")
	}
	return
}

func (r *ResourceProcessorEntity) Priority() int {
	return r.EntityPriority
}
